home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
bbs
/
sdl212x.zip
/
MODULE.C
< prev
next >
Wrap
C/C++ Source or Header
|
1996-05-15
|
24KB
|
704 lines
//////////////////////////////////////////////////////////////////////////
// MODULE.C: An example for a module run from one of stardock loco's expansion
// slots. Feel free to use this code for any stardock loco modules.
// This was compiled using Borland Turbo C++ version 3.0
// This will _not_ compile without Brian Pirie's Opendoors odoorh.lib (huge model)
// Also feel free to upgrade my version of Guido's Black Market.
// Note: It is crucial to the game that they be able to upgrade their
// armor and weapon strength at the higher levels! Make sure to keep that
// if you make a better black market.
/////////////////////////////////////////////////////////////////////////////
// Do not distribute any modules that use unregistered serial comm libraries!
/////////////////////////////////////////////////////////////////////////////
// Ok, enough of that, here's how I call this program. This is the actual
// code that I use to spawn _from_ stardock loco for anyone that goes into the
// black market: i.e. blkmkt1.exe
//
// Note: This is nearly identical to, and works the same way from any expansion
// slots in the game. The 'Yards expansion slots gets the filepath from
// the module.lst, and does the same thing as below. The other slots
// are run by using _dos_find_first to find the first occurance of the first
// two letters. See sd_devlp.txt for all the gruesome details.
//
// any od_control structure usage is from Brian Pirie's Opendoors 6.0 serial
// comm library. Get his program and register it.
//
// od_control.info_path is the path to the door.sys, or whatever the file
// is that has the BBS information on the user.
//
//
// Make sure it's there, or look for an upgrade to blkmkt2.exe etc.
//
// if( _dos_findfirst("blkmkt?.exe",_A_NORMAL,&ffblk) ==0)
// {
// update_player_file(); //update the player file before spawn
//
// od_spawnvpe(P_WAIT,filepath,_argv,NULL);
// check_it(); //make sure they aren't dead.
// - this is for real modules.
// A person can't die in the black market.
// }
//////////////////////////////////////////////////////////////////////////
//
// Guido's Black Market
// Formerly known as Indelgo's Black Market.
//////////////////////////////////////////////////////////////////////////
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <dos.h>
#include <time.h>
#include "opendoor.h"
//from Brian Pirie's Opendoors 6.0 serial comm library
//contains all the functions and structures necessary for comm routines.
//Update, I've begun using 6.0. New things shall arise. See the web site:
// http://www.starlink.com/~jam/ (Follow the links)
// http://www.starlink.com/~alanen (My weird page)
#include <ctype.h>
#include <errno.h>
//see sd_devlp.txt for all the information on this stuff.
#define MAX 2
#define MAXNAME 30
#define MAXBBSNAME 36
#define MAXWEAPONNAME 20
#define MAXARMORNAME 20
#define MAXSTANDARDLONG 10
#define MAXSTANDARDINT 4 //standard integer
#define WAIT_FOR_FILE 10 /* Time to wait for access to file */
FILE *OpenExclusiveFile(char *pszFileName, char *pszAccess, time_t Wait); //exclusive file access
void update_player_file(void);
void r_player_file(void);
void WaitForEnter(void);
void More(void);
void door(void);
void indelgos_bm(void); //the module
void change(void); //formats numbers to nice numbers with commas
struct on_line_player //See the sd_devlp.txt for further explanations!!
{
int on_now;
char name[MAXNAME+1];
char bbs_name[MAXBBSNAME+1];
int living; //if alive = 1
char killer[MAXNAME+1]; //who killed player
int location; //1 if in TP's, 2 if in pod
long lifepoints;
long lifepointsttl;
char weapon[MAXWEAPONNAME+1];
unsigned long weapon_energy;
int weapon_strength;
unsigned long max_packs;
int weapon_status;
unsigned long weapon_cost;
char armor[MAXARMORNAME+1];
unsigned long armor_strength;
int armor_status;
unsigned long armor_cost;
unsigned long credits;
unsigned long bank_credit;
int pod;
int ship;
char ship_name[MAXNAME+1];
int ship_type;
int mt; //matter transmitter
int arkon_bomb;
//*extra data:
int level;
unsigned long experience;
int kills;
int droids;
int passkey;
//assorted stuff *global* //
int on_off; //on off for off-line droid attack
//reset daily by extern: //from defaults....
int sickbay_closed; //killed staff
int bank_closed; //angered guido
int pickpocket; //picked N. Wetlys pocket
int tipcnt; //max tips taken
int owns; //1 owns weapon shop, 2 owns armor shop
int fights; //fights per day 30?
int last_played; //stardock days running
};
struct on_line_player current;
struct player
{
char on_now[MAXSTANDARDINT+1];
char name[MAXNAME+1];
char bbs_name[MAXBBSNAME+1];
char living[MAXSTANDARDINT+1]; //if alive = 1
char killer[MAXNAME+1];
char location[MAXSTANDARDINT+1];
char lifepoints[MAXSTANDARDLONG+1];
char lifepointsttl[MAXSTANDARDLONG+1];
char weapon[MAXWEAPONNAME+1];
char weapon_energy[MAXSTANDARDLONG+1];
char weapon_strength[MAXSTANDARDINT+1];
char max_packs[MAXSTANDARDLONG+1];
//if they have a weapon = 1
char weapon_status[MAXSTANDARDINT+1];
char weapon_cost[MAXSTANDARDLONG+1];
char armor[MAXARMORNAME+1];
char armor_strength[MAXSTANDARDLONG+1];
char armor_status[MAXSTANDARDINT+1]; //if they have armor = 1
char armor_cost[MAXSTANDARDLONG+1];
char credits[MAXSTANDARDLONG+1];
char bank_credit[MAXSTANDARDLONG+1];
char pod[MAXSTANDARDINT+1];
char ship[MAXSTANDARDINT+1];
char ship_name[MAXNAME+1];
char ship_type[MAXSTANDARDINT+1];
char mt[MAXSTANDARDINT+1];
char arkon_bomb[MAXSTANDARDINT+1];
char level[MAXSTANDARDINT+1];
char experience[MAXSTANDARDLONG+1];
char kills[MAXSTANDARDINT+1];
char droids[MAXSTANDARDINT+1];
char passkey[MAXSTANDARDINT+1];
//globals
char on_off[MAXSTANDARDINT+1];
char sickbay_closed[MAXSTANDARDINT+1];
char bank_closed[MAXSTANDARDINT+1];
char pickpocket[MAXSTANDARDINT+1];
char tipcnt[MAXSTANDARDINT+1];
char owns[MAXSTANDARDINT+1];
char fights[MAXSTANDARDINT+1];
char last_played[MAXSTANDARDINT+1];
};
int playerfound=0;
char door_sys_name[MAXBBSNAME+1];
int record_count;
char number[14]; //for formatted credit amounts and such. See change();
//NEW:
char sdpath[80]; //Path to SDL's player.lst. It is contained in sdpath.dat
//main()/WinMain() 32 bit is:
//Straight out of Brian Pirie's example, ez_vote.c from Opendoors 6.0
//This is his wording, coding, etc. It works. So I changed to his.
//You don't have to include this for now, but it may help later when I
//create a 32 bit version. (Real one. :)
/* main() or WinMain() function - Program execution begins here. */
#ifdef ODPLAT_WIN32
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow)
#else
int main(int argc, char *argv[])
#endif
{
#ifdef ODPLAT_WIN32
/* In Windows, pass in nCmdShow value to OpenDoors. */
od_control.od_cmd_show = nCmdShow;
/* Ignore unused parameters. */
(void)hInstance;
(void)hPrevInstance;
#endif
/* Set program's name for use by OpenDoors. */
//Change this for yours please...<G>!
strcpy(od_control.od_prog_name, "Stardock Loco WIN95/NT - DOS 16bit");
strcpy(od_control.od_prog_version, "Version 1 BETA");
strcpy(od_control.od_prog_copyright, "Copyright 1995-1996 by Aaron Alanen");
/* Call the standard command-line parsing function. You will probably */
/* want to do this in most programs that you write using OpenDoors, as it */
/* automatically provides support for many standard command-line options */
/* that will make the use and setup of your program easer. For details, */
/* run the vote program with the /help command line option.